# encoding: utf-8
""" 
@version: v1.0 
@author: autumner 
@license: Apache Licence  
@contact: 18322313385@163.com 
@site:  https://gitee.com/autumner/pythoncookbook
@software: PyCharm 
@file: event_TCPClient.py 
@time: 2019/7/23 下午2:43
@note:
基于事件驱动的TCP客户端
"""
from socket import *

s = socket(AF_INET, SOCK_STREAM)
s.connect(('localhost', 16000))
s.send(b'hello Tcp')
print(s.recv(8192))
s.send(b'Hello world!')
print(s.recv(8192))
s.send(b'Hello world!')
print(s.recv(8192))